# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: s1gma <s1gma@mindslicer.com>

pkgname=medusa
pkgver=2.2
pkgrel=11
pkgdesc='Speedy, massively parallel and modular login brute-forcer for network'
url='http://www.foofus.net/jmk/medusa/medusa.html'
arch=('loong64' 'x86_64')
license=('GPL2')
depends=('openssl')
# TODO: revisit rdp if freerdp2 is supported
optdepends=(
  'openssl: HTTP, MSSQL, SMBNT and SSL-based connection support'
  'libssh2: SSH support'
  'postgresql-libs: PostgreSQL support'
  'afpfs-ng: AFP support'
  'subversion: Subversion support')
makedepends=('libssh2' 'libpqxx' 'afpfs-ng' 'subversion' 'freerdp')
source=(${pkgname}-${pkgver}.tar.gz::http://www.foofus.net/jmk/tools/${pkgname}-${pkgver}.tar.gz
        ${pkgname}-openssl-1.1.patch::https://github.com/jmk-foofus/medusa/commit/349ef7f0c24b627c6dbba8bcd5b47173806473a2.patch)
sha512sums=('4117c95e9a93c1cdf275c33f86046811b7100bfc4430464d66051e736dcf105a0733855d896ee0ea85c02a6dd3d3c060c8a84bb795f9870ec589fd9a87232690'
            'df94ab0c31da5b552da5ff4998909f7df31054516154010c22a3f7f076525757e079891310647fd0d704e5850b508b5708084489f84b38c49e79e7b4ecf7e85a')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -p1 < "${srcdir}/${pkgname}-openssl-1.1.patch"
  autoreconf -fiv
}

build() {
  cd ${pkgname}-${pkgver}
  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
  ./configure --prefix=/usr \
    CFLAGS="${CFLAGS} $(pkg-config --cflags freerdp2)"
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 misc/zsh/_medusa "${pkgdir}/usr/share/zsh/site-functions/_medusa"
  install -Dm 644 doc/*.html README NEWS ChangeLog -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
